var AllOptions = {

    createOption3: function (labelList, dataList) { //i类疫苗近半年使用量及异常反应量
        return {
            grid: {
                left: 70,
                top: 50,
                bottom: 45,
                right: 20
            },
            title: {
                text: '单位：个',
                textStyle: {
                    color: '#fff',
                    fontSize: 16
                },
                left: 10,
                top: 10
            },

            xAxis: {
                type: 'category',
                data: labelList,
                axisLabel: {
                    inside: false,
                    textStyle: {
                        color: '#fff',
                        fontSize: 16
                    },
                    interval: 0, //保证所有横向坐标数据全展示不隐藏
                    margin: 10 //刻度与坐标轴距离
                },
                axisTick: {
                    show: false
                },
                axisLine: {
                    show: true, //不显示y轴
                    symbol: ['none'],
                    symbolOffset: [0, 14],
                    lineStyle: {
                        color: 'rgba(1, 60, 217, 1)'
                    }
                },
                splitLine: {
                    show: false, //纵向网格线
                    lineStyle: {
                        color: ['#334c69']
                    }
                }
            },
            yAxis: {
                type: 'value',
                axisLabel: {
                    inside: false,
                    textStyle: {
                        color: '#fff',
                        fontSize: 16
                    },
                    // interval: 0,
                    margin: 20 //刻度与坐标轴距离
                },
                axisTick: {
                    show: false //不显示刻度
                },
                axisLine: {
                    show: true, //不显示y轴
                    symbol: ['none'],
                    symbolOffset: [0, 14],
                    lineStyle: {
                        color: 'rgba(1, 60, 217, 1)'
                    }
                },
                splitLine: {
                    show: false, //横向网格线
                    lineStyle: {
                        color: ['#334c69']
                    }
                },
                splitArea: {
                    show: true, //横向网格区域
                    areaStyle: {
                        color: ['rgba(0, 70, 255, 0.1)', 'rgba(5,39,75,0)']
                    }
                }
            },
            legend: {
                show: true,
                top: 10,
                // right: 40,
                zlevel: 10,
                icon: 'roundRect',
                itemWidth: 20, // 设置宽度
                itemHeight: 14, // 设置高度
                itemGap: 20, // 设置间距
                textStyle: {
                    color: '#fff',
                    fontSize: 16
                },
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: { // 横坐标指示器
                    type: 'line',
                    lineStyle: {
                        color: 'rgba(0,0,0,0)'
                    }
                },
                // alwaysShowContent: true, //悬浮后一直显示
                // 自定义悬浮提示框内容（数据处理后加单位）
                backgroundColor: 'rgba(0,0,0,0)',
                formatter: function (params) { // params的个数等于折线的条数（对多条折线数据进行加单位，就需要遍历）
                    var relVal = '<div class="bg_2_tip" style="text-align:left;padding:20px 30px;font-size:14px "><span style="color:#fff;font-size:20px">' + params[0].name + '</span>' + (params[0] ? '<br><span class="color-blue-2">' + params[0].seriesName + '<span class="color-yellow-2 f20 pl10">' + params[0].value + '</span>个</span>' : '') + '' + (params[1] ? '<br><span class="color-blue-2">' + params[1].seriesName + '<span class="color-yellow-2 f20 pl10">' + params[1].value + '</span>个</span>' : '') + '' + (params[2] ? '<br><span class="color-blue-2">' + params[2].seriesName + '<span class="color-yellow-2 f20 pl10">' + params[2].value + '</span>个</span>' : '') + '' + (params[3] ? '<br><span class="color-blue-2">' + params[3].seriesName + '<span class="color-yellow-2 f20 pl10">' + params[3].value + '</span>个</span>' : '') + '</div>'
                    return relVal
                }
            },
            series: [{
                color: 'rgba(41, 161, 247, 1)',
                name: '使用量',
                type: 'bar',
                data: dataList[0],
                stack: '总量',
                label: {
                    show: true,
                    position: 'inside',
                    formatter: '{c}',
                    color: '#fff'
                },
                // symbol: 'circle', //
                barWidth: 30
            }, {
                color: 'rgba(235, 52, 50, 1)',
                name: '异常反应量',
                type: 'bar',
                data: dataList[1],
                stack: '总量',
                label: {
                    show: true,
                    position: 'inside',
                    formatter: '{c}',
                    color: '#fff'
                },
                // symbol: 'circle', //
                barWidth: 30
            }]
        }
    },
    createOption4: function (mapCityJson, dataList) {
        echarts.registerMap('zj', mapCityJson);
        var geoCoordMap = {}
        for (var i = 0; i < mapCityJson.features.length; i++) {
            var name = mapCityJson.features[i].properties.name
            geoCoordMap[name] = mapCityJson.features[i].properties.center
        }
        var formatData = {} //将地址名字和对应的数据转化为map对象
        for (var i = 0; i < dataList.length; i++) {
            var name = dataList[i][1].name
            formatData[name] = dataList[i][1].value
        }

        var convertData = function (data) { //给覆盖物层加入坐标
            var res = [];
            for (var i = 0; i < data.length; i++) {
                var dataItem = data[i];
                var fromCoord = geoCoordMap[dataItem[0].name];
                var toCoord = geoCoordMap[dataItem[1].name];
                if (fromCoord && toCoord) {
                    res.push({
                        fromName: dataItem[0].name,
                        toName: dataItem[1].name,
                        coords: [fromCoord, toCoord]
                    });
                }
            }
            return res;
        };
        var series = [{
                left: 150,
                right: 30,
                top: 20,
                bottom: 10,
                name: '',
                type: 'map',
                mapType: 'zj', // 自定义扩展图表类型
                itemStyle: {
                    normal: {
                        label: {
                            show: true,
                            color: '#fff'
                        },
                        areaColor: '#002587',
                        borderWidth: 2,
                        borderColor: '#1548af',

                    },
                    emphasis: {
                        label: {
                            show: true,
                            color: '#fff'
                        },
                        areaColor: '#ceaf0f',
                        borderWidth: 3,
                        borderColor: '#1548af',
                    }
                },
                data: mapCityJson.features.map(function (item) {
                    if (formatData[item.properties.name]) {
                        return {
                            name: item.properties.name,
                            value: formatData[item.properties.name].ltcpsl * 1,
                            otherValue: formatData[item.properties.name]
                        }
                    } else {
                        return {
                            name: item.properties.name,
                            value: 0,
                            otherValue: {
                                xl: 0,
                                ytqysl: 0,
                                ltcpsl: 0
                            }
                        }
                    }
                })

            }

        ];

        dataList.forEach(function (item, i) {
            series.push({
                name: item[0].name,
                type: 'effectScatter',
                coordinateSystem: 'geo',
                zlevel: 2,
                rippleEffect: {
                    brushType: 'stroke',
                    scale: 6,
                    period: 3,
                },
                // symbolSize:4,
                symbolSize: function (val) {
                    return val[1] / 8;
                },
                itemStyle: {
                    normal: {
                        color: 'rgba(248, 231, 28, 0.5)',
                        borderWidth: 5,
                        borderColor: 'rgba(248, 231, 28, 0.5)'
                    },
                    emphasis: {
                        color: 'rgba(248, 231, 28, 0.5)',
                        borderWidth: 5,
                        borderColor: 'rgba(248, 231, 28, 0.5)'
                    }
                },
                data: dataList.map(function (dataItem) {
                    return {
                        name: dataItem[1].name,
                        value: geoCoordMap[dataItem[1].name].concat([dataItem[1].value])
                    };
                })
            }, {
                name: item[0].name,
                type: 'lines',
                zlevel: 2,
                symbol: ['none'],
                symbolSize: 10,
                effect: {
                    show: true,
                    period: 6,
                    trailLength: 0,
                    symbol: 'arrow', //planePath,
                    color: '#f0ff00',
                    symbolSize: 12
                },
                lineStyle: {
                    normal: {
                        color: '#f0ff00',
                        width: 1,
                        opacity: 0.6,
                        curveness: 0.2
                    }
                },
                data: convertData(dataList)
            }, {
                name: "中心点",
                type: "effectScatter",
                coordinateSystem: "geo",
                zlevel: 3,
                rippleEffect: {
                    brushType: "stroke"
                },
                label: {
                    normal: {
                        show: true,
                        position: "right",
                        formatter: "{b}",
                        textStyle: {
                            fontSize: 15,
                            fontWeight: "bolder"
                        }
                    }
                },
                symbolSize: 20,
                itemStyle: {
                    normal: {
                        color: "red"
                    }
                },
                data: [{
                    name: "宁波市", //出发点
                    value: [121.549792, 29.868388, "宁波市"]
                }]
            });
        });

        option = {
            visualMap: {
                show: false,
                type: 'continuous',
                orient: 'vertical',
                left: 30,
                bottom: 240,
                // min:0,
                // max:1000,
                align: 'bottom',
                text: ['高', '低'],
                dimension: 0, //制定第一个数据（value）
                calculable: true,
                seriesIndex: 0, //重要，制定第一组数据作为关联项，不设置时波纹小圆圈的颜色会跟随这个颜色
                textStyle: {
                    color: 'rgba(56, 235, 249, 1)'
                },
                range: [0, 1000],
                formatter: '{value}', //对应数据中的value字段
                inRange: {
                    color: ['rgba(0,25,92,1)', 'rgba(27,109,255,1)']
                },
                outOfRange: {
                    color: ['#111']
                },
            },
            geo: {
                map: 'zj',
                label: {
                    emphasis: {
                        show: false
                    }
                },
                aspectScale: 0.75,
                roam: false,
                zoom: 1.2,
                left: 210,
                top: 85,
                right: 90,
                bottom: 75,
                // layoutCenter: ['80%', '30%'],
                itemStyle: {
                    normal: {
                        areaColor: '#eee',
                        borderWidth: 4,
                        borderColor: '#37e7f6',
                        shadowColor: 'rgba(56, 235, 249, 1)',
                        shadowBlur: 10
                    },
                    emphasis: {
                        areaColor: '#2a333d'
                    }
                }
            },
            series: series
        };
        return option
    },

}